package com.bjsxt.common.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateFormatUtil
{
	public static String datePattern=ConstantFinal.BUNDLE.getString("myDate");
	public static String dateTimePattern=ConstantFinal.BUNDLE.getString("myDateTime");
	
	public static String formatDate(Date date)
	{
		SimpleDateFormat sdf=new SimpleDateFormat(datePattern);
		String dateString = sdf.format(date);
		return dateString;
	}
	public static String formatDateTime(Date date)
	{
		SimpleDateFormat sdf=new SimpleDateFormat(dateTimePattern);
		String dateString = sdf.format(date);
		return dateString;
	}
	public static Date parseIntoDate(String dateStr)
	{
		SimpleDateFormat sdf=new SimpleDateFormat(datePattern);
		try
		{
			return sdf.parse(dateStr);
		} catch (ParseException e)
		{
		}
		return null;
	}
	public static Date parseIntoDateTime(String dateStr)
	{
		SimpleDateFormat sdf=new SimpleDateFormat(dateTimePattern);
		try
		{
			return sdf.parse(dateStr);
		} catch (ParseException e)
		{
		}
		return null;
	}
}
